//
//  MServerDAOProtocol.h
//  MClient
//
//  Created by  史正烨 on 09-10-3.
//  Copyright 2009 __MyCompanyName__. All rights reserved.
//

@protocol MCServer2ViewDelegate<NSObject>//告诉view数据已取到，请处理
@optional
// 从服务器取数据成功
- (void)getDataFromServerSuccess: (NSMutableDictionary *)returnValue;
// 从服务器取数据成功消息
- (void)getServerSuccess: (NSString *)returnCode returnMessage:(NSString *)returnMessage;
// 从服务器取数据失败
- (void)getServerError: (NSString *)returnCode returnMessage:(NSString *)returnMessage;
@end

@protocol MServerDAOProtocol

@optional
- (void)loginAsync:(NSString *)partyId 
			userId:(NSString *)userId 
		  password:(NSString *)password 
			  imei:(NSString *)imei 
			  imsi:(NSString *)imsi 
			 acode:(NSString *)acode
		  delegate:(id<MCServer2ViewDelegate>)delegate;

@optional
- (id)login:(NSString *)partyId 
	 userId:(NSString *)userId 
   password:(NSString *)password 
	   imei:(NSString *)imei
	   imsi:(NSString *)imsi
	  acode:(NSString *)acode;

- (void)logoutAsync;

- (id)getApps;

- (void)getAppsAsync:(id<MCServer2ViewDelegate>)delegate;

- (id)getMenuOfApp:(NSString *)appId;

- (void)getMenuOfAppAsync:(NSString *)appId 
			  otherParams:(NSMutableDictionary *)otherParams
				 delegate:(id<MCServer2ViewDelegate>)delegate;

- (id)getSubMenu:(NSString *)menuId;

- (void)getSubMenuAsync:(NSString *)menuId 
			otherParams:(NSMutableDictionary *)otherParams
			   delegate:(id<MCServer2ViewDelegate>)delegate;

- (void)getMenuConfigAsync:(NSString *)menuId
				  delegate:(id<MCServer2ViewDelegate>)delegate;

- (void)getListSizeAsync:(NSString *)dataObjectName 
			  layoutName:(NSString *)layoutName 
			 queryFilter:(NSMutableArray *)queryFilter 
				delegate:(id<MCServer2ViewDelegate>)delegate;

- (id)getListConfig:(NSString *)dataObjectName 
		 layoutName:(NSString *)layoutName;

- (void)getListConfigAsync:(NSString *)dataObjectName 
				layoutName:(NSString *)layoutName 
			   otherParams:(NSMutableDictionary *)otherParams
				  delegate:(id<MCServer2ViewDelegate>)delegate;

- (id)getListData:(NSString *)dataObjectName 
	   layoutName:(NSString *)layoutName 
	  queryFilter:(NSMutableArray *)queryFilter 
			 page:(int)page;

- (void)getListDataAsync:(NSString *)dataObjectName 
			  layoutName:(NSString *)layoutName 
			 queryFilter:(NSMutableArray *)queryFilter 
					page:(int)page 
				delegate:(id<MCServer2ViewDelegate>)delegate;

- (id)getFormConfig:(NSString *)dataObjectName 
		 layoutName:(NSString *)layoutName 
		   editable:(NSString *)editable;

- (void)getFormConfigAsync:(NSString *)dataObjectName 
				layoutName:(NSString *)layoutName 
				  editable:(NSString *)editable 
			   otherParams:(NSMutableDictionary *)otherParams
				  delegate:(id<MCServer2ViewDelegate>)delegate;

- (id)getFormData:(NSString *)dataObjectName 
	   layoutName:(NSString *)layoutName 
			  key:(NSString *)key 
	   isEditable:(NSString *)edittable;

- (void)getFormDataAsync:(NSString *)dataObjectName 
			  layoutName:(NSString *)layoutName 
					 key:(NSString *)key 
			  isEditable:(NSString *)editable 
				delegate:(id<MCServer2ViewDelegate>)delegate;

- (id)saveFormData:(NSString *)buttonId 
		buttonType:(NSString *)buttonType 
	dataObjectName:(NSString *)dataObjectName 
		  formData:(NSMutableDictionary *)formData;

- (void)saveFormDataAsync:(NSString *)buttonId 
			   buttonType:(NSString *)buttonType 
		   dataObjectName:(NSString *)dataObjectName 
				 formData:(NSMutableDictionary *)formData 
			  otherParams:(NSMutableDictionary *)otherParams
				 delegate:(id<MCServer2ViewDelegate>)delegate;

- (id)deleteData:(NSString *)buttonId 
	  buttonType:(NSString *)buttonType 
  dataObjectName:(NSString *)dataObjectName 
			keys:(NSMutableArray *)keys;

- (void)deleteDataAsync:(NSString *)buttonId 
			 buttonType:(NSString *)buttonType 
		 dataObjectName:(NSString *)dataObjectName 
				   keys:(NSMutableArray *)keys 
			otherParams:(NSMutableDictionary *)otherParams
			   delegate:(id<MCServer2ViewDelegate>)delegate;

-  (id)doServiceByRecord:(NSString *)buttonId 
			  buttonType:(NSString *)buttonType 
		  dataObjectName:(NSString *)dataObjectName 
				 records:(NSMutableArray *)records;

-  (void)doServiceByRecordAsync:(NSString *)buttonId 
					 buttonType:(NSString *)buttonType 
				 dataObjectName:(NSString *)dataObjectName 
						records:(NSMutableArray *)records 
				   serviceDefId:(NSString *)serviceDefId 
					otherParams:(NSMutableDictionary *)otherParams
					   delegate:(id<MCServer2ViewDelegate>)delegate;

-  (void)calcAsync:(NSString *)lookupBack
	dataObjectName:(NSString *)dataObjectName 
		   records:(NSMutableArray *)records 
	  serviceDefId:(NSString *)serviceDefId 
		  delegate:(id<MCServer2ViewDelegate>)delegate;

- (id)getTree:(NSString *)treeId 
  queryFilter:(NSMutableArray *)queryFilter;

- (void)getTreeAsync:(NSString *)treeId 
		 queryFilter:(NSMutableArray *)queryFilter 
			delegate:(id<MCServer2ViewDelegate>)delegate;

- (void)getNodeAsync: (NSString *)nid 
			  treeId:(NSString *)treeId 
		 queryFilter:(NSMutableArray *)queryFilter 
			   param:(NSMutableDictionary *)param  
			delegate:(id<MCServer2ViewDelegate>)delegate;

- (id)getReportConfig:(NSString *)reportName;

- (void)getReportConfigAsync:(NSString *)reportName 
				 otherParams:(NSMutableDictionary *)otherParams
					delegate:(id<MCServer2ViewDelegate>)delegate;

- (void)modifyPasswordAsync:(NSString *)oldPassword
				   password:(NSString *)password 
				   delegate:(id<MCServer2ViewDelegate>)delegate;

- (void)downloadAsync:(NSString *)actionType 
			 dataFrom:(NSString *)dataFrom 
				param:(NSMutableDictionary *)param 
			 delegate:(id<MCServer2ViewDelegate>)delegate;

- (void)downloadFileWithUrlAsync:(NSString *)url 
					saveLocation:(NSString *)saveLocation 
						delegate:(id)aDelegate;

- (void)uploadAsync:(NSString *)data 
		   delegate:(id<MCServer2ViewDelegate>)delegate;

- (void)getUploadFileNameAsync:(id<MCServer2ViewDelegate>)delegate;

- (void)uploadFileAsync:(NSString *)actionType 
			   location:(NSString *)location 
				   data:(NSInputStream *)data 
			   delegate:(id<MCServer2ViewDelegate>)delegate;

- (void)downloadFileAsync:(NSString *)actionType 
				 dataFrom:(NSString *)dataFrom 
				 location:(NSString *)location 
				 fileName:(NSString *)fileName 
					 page:(int)page
					 type:(NSString *)type 
			 saveLocation:(NSString *)saveLocation 
				 delegate:(id<MCServer2ViewDelegate>)delegate;

- (void)getCustomFormAsync:(NSString *)key 
				layoutName:(NSString *)layoutName 
			   queryFilter:(NSMutableArray *)queryFilter 
			   otherParams:(NSMutableDictionary *)otherParams
				  delegate:(id<MCServer2ViewDelegate>)delegate;

- (void)getCustomListAsync:(NSString *)layoutName 
			   queryFilter:(NSMutableArray *)queryFilter 
					  page:(NSString *)page 
			   otherParams:(NSMutableDictionary *)otherParams
				  delegate:(id<MCServer2ViewDelegate>)delegate;

- (void)getContactsAsync:(id<MCServer2ViewDelegate>)delegate;

- (void)downloadContact:(NSString *)contactId
				   page:(int)page
			   delegate:(id<MCServer2ViewDelegate>)delegate;

- (void)uploadContact:(NSString *)contactId
			  records:(NSMutableArray *)records
			 delegate:(id<MCServer2ViewDelegate>)delegate;

- (void)getFileList:(NSString *)dataFrom 
		  fileParam:(NSMutableDictionary *)fileParam 
		   delegate:(id<MCServer2ViewDelegate>)delegate;

@end
